define(['text!service/addwarrantyCard.html'],
	function(viewTemplate) {
		return Piece.View.extend({
			id: 'service_addwarrantyCard',
			events: {
				"click #submit": "submit",
				"click #submit1": "submit1",
				"click #submit2": "submit2",
				"click #submit3": "submit3",
			},
			render: function() {
				$(this.el).html(viewTemplate);

				Piece.View.prototype.render.call(this);
				return this;
			},
			onShow: function() {
				//write your business logic here :)


				var windowHeight = $(window).height();

				console.info(windowHeight);
				var elTop = $("#addwarrantyCard").offset().top;
				var elHeight = windowHeight - elTop;
				console.info(elTop);
				console.info(elHeight);
				$("#addwarrantyCard").css({
					"height": elHeight
				});
				new iScroll($("#addwarrantyCard")[0]);



				// $("#warrantyCard")[0].refresh();

			},
			submit: function() {


				this.container.navigateForResult('/service/warrantyCard2', {
					trigger: true
				}, 'service/addwarrantyCard', this.onGotResult);
			},
			submit1: function() {

				console.log("条码扫描");
				cordova.exec(function(data) {

					console.info(data);

					$("barcode").val(data);

				}, function(err) {

				}, "BarCode", "barcode", []);

			},
			submit2: function() {

				var recommend = document.getElementById("img2");
				recommend.style.display = 'block';


			},

			submit3: function() {

				var recommend = document.getElementById("img3");
				recommend.style.display = 'block';
			}
		}); //view define

	});